import logging,yamail,HTMLTestRunner_cn

class Tools():
    def log(self):
        log = logging.basicConfig(level=logging.DEBUG,
                                  filename=r'E:\gg4\PythonProject1\po_A3mall\log\a3mall.log',
                                  filemode='a+',
                                  format='%(filename)s-%(asctime)s-%(message)s-%(levelname)s-%(lineno)d')
        return log

    def report(self):
        report = HTMLTestRunner_cn.HTMLTestRunner(open(r'E:\gg4\PythonProject1\po_A3mall\report\A3mall.html','wb'),
                                                  title='A3mall测试数据',
                                                  description='A3mall')
        return report

    def mail(self):
        mail = yamail.SMTP(user='3080172040@qq.com',password='ceswygiwtqzcdfhd',host='smtp.qq.com',port=465)
        mail.send(to='3080172040@qq.com',subject='A3mall项目',contents=['执行用例，通过',
                                                       r'E:\gg4\PythonProject1\po_A3mall\log\a3mall.log',
                                                       r'E:\gg4\PythonProject1\po_A3mall\report\A3mall.html'])
        mail.close()